package core;

import java.util.ArrayList;
import java.util.Vector;
//import java.util.Iterator;
import java.util.List;


public class ClusteringNode {
 
	private Neighborhood _mean;
    private Vector <Neighborhood> _data;
    private List <ClusteringNode> _children;
 
   
    public ClusteringNode() 
    {
        super();
        _children = new ArrayList <ClusteringNode>();
    }
 
    public ClusteringNode(Vector <Neighborhood> data) 
    {
    	this();
        setData(data);
    }
    
    public ClusteringNode(Neighborhood m, Vector <Neighborhood> data) 
    {
        this(data);
        setMean(m);
    }
    
    public ClusteringNode(Neighborhood m, Vector <Neighborhood> data, List <ClusteringNode> chldr) 
    {
        this(m, data);
        setChildren(chldr);
    }
    
    public boolean hasChildren()
    {
    	if ((_children == null) || _children.isEmpty()) 
    		return false;
    	else 
    		return true;
    }
    
    public List getChildren() 
    {
        if (this._children == null) 
        {
            return new ArrayList();
        }
        
        return this._children;
    }
    
    public void setChildren(List <ClusteringNode> children) 
    {
        this._children = children;
    }
 
    public void addChildren(ClusteringNode n)
    { 
    	this._children.add(n);
    }
    
    public void addChildren(Neighborhood m, Vector <Neighborhood> data)
    {
    	ClusteringNode n = new ClusteringNode(m, data); 
    	this._children.add(n);
    }
    
    public List getData() 
    {
        return this._data;
    }
 
    public void setData(Vector <Neighborhood> data) 
    {
        this._data = data;
    }
    
    public Neighborhood getMean() 
    {
        return _mean;
    }
 
    public void setMean(Neighborhood mean) 
    {
        _mean = mean;
    }
    
    public int getDimension()
    {
    	return _data.size();
    }
}
